<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class navigation_model extends Model
{
	function navigation_model()
	{
		parent::Model();
	}
	
	function admin_id()
	{
		global $CI;
		$a = $CI->session->userdata('admin_auth_logged');
		return $a['admin_id'];
	}
	
	function fullname($cid=0)
	{
		$q = $this->db->get_where(NAVIGATION, array(NAVIGATION_FRANCHISE_ID=>$this->admin_id(), NAVIGATION_MENU_ID=>$cid));		
		$row = $q->row();
		if (!$row)
			return "";

		if (!$row->{NAVIGATION_PAR_MENU_ID} || $row->{NAVIGATION_PAR_MENU_ID}==$row->{NAVIGATION_MENU_ID})
			return $row->{NAVIGATION_NAME};

		return $this->fullname($row->{NAVIGATION_PAR_MENU_ID})." > ".$row->{NAVIGATION_NAME};
	}
}

?>